package com.yonyou.gmmc.service.pointactivity.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.yonyou.gmmc.common.annotation.OracleDb;
import com.yonyou.gmmc.service.pointactivity.model.TmReturnFactory;
import com.yonyou.gmmc.service.pointactivity.model.TmSweepstake;
import com.yonyou.gmmc.service.pointactivity.model.TtReturnFactoryReserve;

import tk.mybatis.mapper.common.Mapper;

import com.yonyou.gmmc.service.pointactivity.model.TcSysConfig;
import com.yonyou.gmmc.service.pointactivity.model.TmDealer;
import com.yonyou.gmmc.service.pointactivity.model.TmRegion;

/**
 * 省市县地区查询mapper接口类
 * @author baodu
 *
 */
@OracleDb
public interface ReservationMapper extends Mapper<TtReturnFactoryReserve> {

	/**
	 * 根据父级id查询所有省市县数据
	 * @return
	 */
	public List<TmRegion> selectProvince(String parentCode);
	
	/**
	 * 根据城市编码查询对应的经销商集合信息
	 * @return
	 */
	public List<TmDealer> selectDealer(@Param("regionCode")String regionCode);
	
	/**
	 * 保存信息
	 * @param reserve
	 */
	public void save(TtReturnFactoryReserve reserve);
	
	/**
	 * 查询一年未返厂活动时间
	 * @param str
	 * @return
	 */
	public List<TcSysConfig> selectTime(List<String>keys);
	
	/**
	 * 查询临时表中各省份未返厂车辆占比及奖券数量
	 * @return
	 */
	public List<TmReturnFactory> getProvinceAndVin();
	
	/**
	 * 分配奖券到奖券表
	 */
	public void allotLotteries(TmSweepstake sweepstake);
	
	/**
	 * 根据openId查询是否已经预约
	 * @return
	 */
	public List<TtReturnFactoryReserve> getByopenId(@Param("openId") String openId);
	/**
	 * 根据省份名称查询是否存在
	 * @param province
	 * @return
	 */
	public List<TmRegion> selectByProvince(@Param("province")String province);
	/**
	 * 根据城市名称查询是否存在
	 * @param dealerCode
	 * @return
	 */
	public List<TmRegion> selectByCity(@Param("city")String city);
	/**
	 * 根据经销商名称查询是否存在
	 * @param dealerCode
	 * @return
	 */
	public List<TmDealer> selectByDealer(@Param("dealerCode")String dealerCode);
	
	/**
	 * 根据openId查询用户车辆所在地省份
	 * @param openId
	 * @return
	 */
	public String findByProvince(@Param("openId")String openId);
	
}
